package com.laf.manage.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;

@Getter
public enum ContentTypeEnum {
    DYNAMIC(1, "动态"),
    LOST_ITEM(2, "失物");

    @JsonValue
    @EnumValue
    private final Integer code;
    private final String desc;

    ContentTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static ContentTypeEnum getEnumByCode(Integer code) {
        for (ContentTypeEnum typeEnum : ContentTypeEnum.values()) {
            if (typeEnum.getCode().equals(code)) {
                return typeEnum;
            }
        }
        return null;
    }

}
